const setRootFontSize = (fontSize) => {
	uni.setStorageSync('root_font_size', fontSize);
	getApp().globalData.rootFontSize = fontSize;
	let currentRoutes = getCurrentPages(); // 获取当前打开过的页面路由数组
	let currentRoute = currentRoutes[currentRoutes.length - 1].route //获取当前页面路由
	let currentParam = currentRoutes[currentRoutes.length - 1].options; //获取路由参数
	// 拼接参数
	let param = ''
	for (let key in currentParam) {
		param += '?' + key + '=' + currentParam[key]
	}
	let localRoute = currentRoute + encodeURIComponent(param);
	uni.reLaunch({
		url: "/pages/index/index?url=" + localRoute
	})
}
const setFontSize = (lang) => {
	var fontSize = uni.getStorageSync('root_font_size');
	if (fontSize) {
		if (fontSize === '16px' && lang == 'zh') {
			setRootFontSize(14 + 'px');
		} else if (fontSize === '14px' && lang == 'zh') {
			setRootFontSize(13 + 'px');
		} else if (fontSize === '12px' && lang == 'zh') {
			setRootFontSize(12 + 'px');
		} else {
			setRootFontSize(fontSize)
		}
	}
}


export {
	setFontSize
}
